package com.uhu.code.help;

import lombok.Data;

@Data
public class ListNode {
    public int val;
    public ListNode next;

    public ListNode(int x) {
        this.val = x;
    }

    /**
     * 添加新节点
     * @param v
     */
    public void addNode(int v) {
        ListNode nw = new ListNode(v);
        if(this.next == null) {
            this.next = nw;
        }else {
            this.next.addNode(v);
        }
    }
}
